package fr.univ.lille1.android.auth;

import fr.univ.lille1.android.domain.User;

public interface AuthenticationService {
	/**
	 * Identifier of the TagThis service.
	 */
	final int TAGTHIS = 0;
	/**
	 * Identifier of the Google Plus service.
	 */
	final int GOOGLE_PLUS = 1;

	/**
	 * Connects the user on a authentication service. This method uses shared
	 * preferences. If there isn't information in this memory, the connection
	 * failed.
	 */
	void connection();

	/**
	 * Connects the user on a authentication service with an login and a
	 * password. This method saves e-mail, token and his date on the shared
	 * preferences.
	 * 
	 * @param login
	 *            Login of the user.
	 * @param password
	 *            Password of the user.
	 */
	void connection(final String login, final String password);

	/**
	 * Disconnects the user on a authentication service. This method flushs
	 * information in shared preferences.
	 */
	void disconnection();

	/**
	 * Checks the connection of the user on the authentication service.
	 * 
	 * @return true when the user is connected.
	 */
	boolean isConnected();

	/**
	 * Checks the validation of the user on the authentication service with the
	 * validation of his token.
	 * 
	 * @return true when the token is already valid.
	 */
	boolean isValid();

	/**
	 * Gets current user authenticated with one of a authentication service.
	 * 
	 * @return User object represented the user authenticated.
	 */
	User getCurrentUser();
}
